<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<link rel="stylesheet" href="css/index2.css">
		<link rel="stylesheet" href="css/reset.css">	
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
	</head>
	<body>
		<div class="root">
			<div class="img_1">
				<img src="images/ren1.png" alt="">
			</div>
			<div class="img_2">
				<img src="images/ren2.png" alt="">
			</div>
			<div class="img_p">
				<img src="images/kuang2.png" alt="">
				<div class="p_s">
					<p>每天上班这么忙,</p>
					<p>哪儿有时间弄吃的,</p>
					<p>还是路边摊管饱又</p>
					<p>方便快捷!</p>
				</div>
			</div>
			<div class="img_p1">
				<img src="images/kuang.png" alt="">
				<div class="p_s_1">
					<p>年轻就是身体好，</p>
					<p>有这么多好吃的摆着，</p>
					<p>控制不住就想去吃!</p>
				</div>
			</div>
			<div class="img_4">
				<audio style="display:none; height: 0" id="bg-music" preload="auto" src="bgm.mp3" loop="loop"></audio>
				<img src="images/yinyue.gif" alt="">
			</div>
			<div class="bottom_img">
				<img src="images/jiantou.gif" alt="">
			</div>
		</div>
		
		
		<script>
			document.ontouchstart = function(evt){
				var touch = evt.targetTouches[0];
				var x = touch.pageX;
				var y = touch.pageY;
				// console.log(x,y)
				var obj;
				document.ontouchmove = function(e){
					var touch1 = e.targetTouches[0];
					var x1 = touch1.pageX;
					var y1 = touch1.pageY;
					// console.log(x1,y1)
					obj = y1-y;
					console.log(obj)
				}
				document.ontouchend = function(){
					document.ontouchmove = null;
					if(obj <= -200){
						location.href='index3.html';
					}
				}
			}
			
			
			
			
			//音乐自动播放
			window.onload=function(){
				autoPlayMusic();
				audioAutoPlay();
			}
			function audioAutoPlay() {
				var audio = document.getElementById('bg-music');
				audio.play();
			}
			// 音乐播放
			function autoPlayMusic() {
				// 自动播放音乐效果，解决浏览器或者APP自动播放问题
				function musicInBrowserHandler() {
					musicPlay(true);
					document.body.removeEventListener('touchstart', musicInBrowserHandler);
				}
				document.body.addEventListener('touchstart', musicInBrowserHandler);
				
			function musicPlay(isPlay) {
				var media = document.querySelector('#bg-music');
				if (isPlay && media.paused) {
					media.play();
				}
				if (!isPlay && !media.paused) {
					media.pause();
				}
			}
			}
		</script>
	</body>
</html>
